package com.hzw.saas.common.config.exception;

import org.springframework.http.HttpStatus;

public class DefaultSaasException extends RuntimeException {

    private static final long serialVersionUID = 1L;

    private HttpStatus httpStatus = HttpStatus.INTERNAL_SERVER_ERROR;

    protected DefaultSaasException(String message) {
        super(message);
    }

    protected DefaultSaasException(String message, Throwable cause) {
        super(message, cause);
    }

    public static DefaultSaasException build(String message) {
        return new DefaultSaasException(message);
    }

    public static DefaultSaasException build(String message, Throwable cause) {
        return new DefaultSaasException(message, cause);
    }

    public DefaultSaasException status(HttpStatus httpStatus) {
        this.httpStatus = httpStatus;
        return this;
    }

    public HttpStatus getHttpStatus() {
        return httpStatus;
    }
}
